const functions = require('firebase-functions');
// Create and Deploy Your First Cloud Functions
// https://firebase.google.com/docs/functions/write-firebase-functions

exports.helloWorld = functions.https.onRequest((request, response) => {
	response.send("Hello from Firebase!I'm Gaubee~~");
});

const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);

exports.countUsers = functions.database.ref('users').onWrite(event => {
	return admin.database().ref('counter/users').set(event.data.numChildren());
});